<div class="refentry" lang="en" xml:lang="en"><a id="gluBeginTrim"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>gluBeginTrim — delimit a NURBS trimming loop definition</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">gluBeginTrim</b>(</code></td><td>GLUnurbs*  </td><td><var class="pdparam">nurb</var><code>)</code>;</td></tr></table></div></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">gluEndTrim</b>(</code></td><td>GLUnurbs*  </td><td><var class="pdparam">nurb</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>nurb</code></em></span></dt><dd><p>
                    Specifies the NURBS object (created with <a class="citerefentry" href="gluNewNurbsRenderer"><span class="citerefentry"><span class="refentrytitle">gluNewNurbsRenderer</span></span></a>).
                </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
            Use <code class="function">gluBeginTrim</code> to mark the beginning of a
            trimming loop and <a class="citerefentry" href="gluEndTrim"><span class="citerefentry"><span class="refentrytitle">gluEndTrim</span></span></a> to mark the end
            of a trimming loop. A trimming loop is
            a set of oriented curve segments (forming a closed curve) that
            define boundaries of a NURBS surface. You include these
            trimming loops in the definition of a NURBS
            surface, between calls to <a class="citerefentry" href="gluBeginSurface"><span class="citerefentry"><span class="refentrytitle">gluBeginSurface</span></span></a> and <a class="citerefentry" href="gluEndSurface"><span class="citerefentry"><span class="refentrytitle">gluEndSurface</span></span></a>.
        </p><p>
            The definition for a NURBS surface can contain many
            trimming loops. For example, if you wrote a definition
            for a NURBS surface that resembled a rectangle with
            a hole punched out, the definition would contain two
            trimming loops. One loop would define the outer edge
            of the rectangle; the other would define
            the hole punched out of the rectangle. The definitions
            of each of these trimming loops would be bracketed by a
            <code class="function">gluBeginTrim</code>/<a class="citerefentry" href="gluEndTrim"><span class="citerefentry"><span class="refentrytitle">gluEndTrim</span></span></a> pair.
        </p><p>
            The definition of a single closed trimming loop can consist
            of multiple curve segments, each described as a piecewise
            linear curve (see <a class="citerefentry" href="gluPwlCurve"><span class="citerefentry"><span class="refentrytitle">gluPwlCurve</span></span></a>) or as a single NURBS
            curve (see <a class="citerefentry" href="gluNurbsCurve"><span class="citerefentry"><span class="refentrytitle">gluNurbsCurve</span></span></a>), or as a combination of
            both in any order. The only library calls that can
            appear in a trimming loop definition (between the calls
            to <code class="function">gluBeginTrim</code> and <a class="citerefentry" href="gluEndTrim"><span class="citerefentry"><span class="refentrytitle">gluEndTrim</span></span></a>) are
            <a class="citerefentry" href="gluPwlCurve"><span class="citerefentry"><span class="refentrytitle">gluPwlCurve</span></span></a> and <a class="citerefentry" href="gluNurbsCurve"><span class="citerefentry"><span class="refentrytitle">gluNurbsCurve</span></span></a>.
        </p><p>
            The area of the NURBS surface that is displayed is the
            region in the domain to the left of the trimming curve
            as the curve parameter increases. Thus, the retained
            region of the NURBS surface is inside a
            counterclockwise trimming loop and outside a clockwise
            trimming loop. For the rectangle mentioned earlier,
            the trimming loop for the outer edge of the rectangle runs
            counterclockwise, while the trimming loop for the punched-out hole
            runs clockwise.
        </p><p>
            If you use more than one curve to define a single trimming
            loop, the curve segments must form a closed loop (that is,
            the endpoint of each curve must be the starting point of the
            next curve, and the endpoint of the final curve must
            be the starting point of the first curve). If the
            endpoints of the curve are sufficiently close together
            but not exactly coincident, they will be coerced to match.
            If the endpoints are not sufficiently close, an error results
            (see <a class="citerefentry" href="gluNurbsCallback"><span class="citerefentry"><span class="refentrytitle">gluNurbsCallback</span></span></a>).
        </p><p>
            If a trimming loop definition contains multiple curves,
            the direction of the curves must be consistent (that is, the
            inside must be to the left of all of the curves). Nested
            trimming loops are legal as long as the curve orientations
            alternate correctly.
            If trimming curves are self-intersecting,
            or intersect one another, an error results.
        </p><p>
            If no trimming information is given
            for a NURBS surface, the entire surface is drawn.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="example"></a><h2>Example</h2><p>
            This code fragment defines a trimming loop that consists of one
            piecewise linear curve, and two NURBS curves:
            </p><pre class="programlisting">
gluBeginTrim(nobj);
   gluPwlCurve(..., GLU_MAP1_TRIM_2);
   gluNurbsCurve(..., GLU_MAP1_TRIM_2);
   gluNurbsCurve(..., GLU_MAP1_TRIM_3);
gluEndTrim(nobj);
            </pre><p>
        </p></div>
        {$pipelinestall}{$examples}
        <div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
            <a class="citerefentry" href="gluBeginSurface"><span class="citerefentry"><span class="refentrytitle">gluBeginSurface</span></span></a>,
            <a class="citerefentry" href="gluNewNurbsRenderer"><span class="citerefentry"><span class="refentrytitle">gluNewNurbsRenderer</span></span></a>,
            <a class="citerefentry" href="gluNurbsCallback"><span class="citerefentry"><span class="refentrytitle">gluNurbsCallback</span></span></a>,
            <a class="citerefentry" href="gluNurbsCurve"><span class="citerefentry"><span class="refentrytitle">gluNurbsCurve</span></span></a>,
            <a class="citerefentry" href="gluPwlCurve"><span class="citerefentry"><span class="refentrytitle">gluPwlCurve</span></span></a>
        </p></div><div class="refsect1" lang="en" xml:lang="en"><div id="Copyright"><h2>Copyright</h2><p>
            Copyright © 1991-2006
            Silicon Graphics, Inc. This document is licensed under the SGI
            Free Software B License. For details, see
            <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
        </p></div></div></div>
